|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectobservations.Quantity
Quantity Represents a value such as 6 feet or 5 $. It's part
of Fowler's pattern 'Quantity'.
| Constructor Summary | |
Quantity(double amount,
Unit unit)
Basic constructor used by all other constructors. |
|
Quantity(int amount,
Unit unit)
Same as basic constructor, but value given as integer. |
|
Quantity(java.lang.String amountString,
Unit unit)
Parses the given string and calls basic constructor. |
|
| Method Summary | |
boolean |
equals(Quantity arg)
Tests if this quantity equals the argument (this == arg). |
double |
getAmount()
Get the quantity's numeric value. |
java.lang.String |
getAmountString()
Gives a string representation of the quantity's value. |
Unit |
getUnit()
Get this quantity's unit. |
boolean |
isGreaterThan(Quantity arg)
Tests if this quantity is greater than argument (this > arg). |
boolean |
isGreaterThanOrEqualTo(Quantity arg)
Tests if this quantity is greater than or equal to argument (this >= arg). |
boolean |
isLessThan(Quantity arg)
Tests if this quantity is less than the argument (this < arg). |
boolean |
isLessThanOrEqualTo(Quantity arg)
Tests if this quantity is less than or equal to argument (this <= arg). |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Quantity(double amount,
Unit unit)
amount - numeric value of the quantityunit - the unit (eg. $)
public Quantity(int amount,
Unit unit)
amount - numeric integer valueunit - the unit (eg. $)Quantity(double, Unit)
public Quantity(java.lang.String amountString,
Unit unit)
amountString - string representation of a numeric valueunit - the unit (eg. $)Quantity(double, Unit)| Method Detail |
public boolean equals(Quantity arg)
arg - other quantity
public double getAmount()
public java.lang.String getAmountString()
public Unit getUnit()
public boolean isGreaterThan(Quantity arg)
arg - other quantity
public boolean isGreaterThanOrEqualTo(Quantity arg)
arg - other quantity
public boolean isLessThan(Quantity arg)
arg - other quantity
public boolean isLessThanOrEqualTo(Quantity arg)
arg - other quantity
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||